<?php
namespace app\auth\controller;
use think\Request;
use think\{
Controller, Db
};
class Upload extends Base{


    public function _initialize(){
        parent::_initialize();
    }


    /**
     * 七牛上传图片
     *
     * @param array $arg
     * @data['folder']  文件夹
     * @return mixed
     */
    public function postUploadPic(){
            $folder= request()->param('folder')?? 'live';
            $check = $this->validate($folder, 'Upload');
            if ($check !== true) {
                return api_return($check);
            } else {
                $config['size'] = 2097152;
                $config['ext'] = 'jpg,png,jpeg,bmp';
                $folder = $folder ? 'live_project/' . $folder : 'live_project/live';
                $list = $this->uploadfile_qiniu($config, $folder);
                if ($list['status'] == 1 && !empty($list['data'])) {
                    return  api_return(200, $list['data']);
                } else {
                    return api_return(-2004, $list['data']);
                }
            }
    }
    
    

}